home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1997 April
/
EnigmA AMIGA RUN 17 (1997)(G.R. Edizioni)(IT)[!][issue 1997-04][EAR-CD].iso
/
EARCD
/
comm
/
mail
/
YAMscripts.lha
/
MakeHotlist.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1996-11-20
|
5KB
|
112 lines
/* MakeHotlist.rexx
v1.0 - 20-Nov-96
This script grabs all URLs from the read messages in the current
folder and creates a hotlist which it sends to a browser.
Currently supported browsers are AWeb, IBrowse and Voyager.
All adresses which end with a character in variable dup_chars will be
duplicated and displayed also without that character.
This script requires rexxreqtools and reqtools libraries, if the
filerequester is used.
Send bug reports, comments and spare bodyparts to knikulai@utu.fi
If you send a message with subject REQUEST INDEX, you'll get a list
of my AREXX scripts. REQUEST <filename> will get you the script you
want.
This script is the grandson of GrabURL.rexx and son of GrabAllURLs.rexx.
I have no idea what the fourth generation will do.
*/
options results
hname='yam:hotlist.html'/* Full path and name of hotlist */
/* If you wish to select the name of the hotlist, uncomment next three lines*/
/*
addlib('rexxreqtools.library',0,-30)
hname=rtfilerequest('yam:','hotlist.html','Enter name of the hotlist',,'rtfi_flags=freqf_save')
if hname='' then exit
*/
dup_chars='.,!?"*%&)' /* If one of these ends the URL, it will be duplicated */
not_found='Sorry,no URLs were found in any of the read messages!'
uc=0 /* URL-counter */
call open(hotlist,hname,'W')
writeln(hotlist,'<html><head><title>URLs from read messages</title></head>')
writeln(hotlist,'<body><center><h3>URLs from read messages in current YAM folder</h3></center>')
writeln(hotlist,'<center>An URL is only displayed once, even if it appears in several messages.</center>')
writeln(hotlist,'<hr><ul>')
address 'YAM'
GetFolderInfo Max
n=result
do viesti=0 to n-1
SetMail viesti
GetMailInfo File
fname=result
GetMailInfo Subject
sub=result
GetMailInfo Status
if pos(result,'UN')=0 then do /* The message isn't new or unread */
if open(msg,fname,'R') then do
do until eof(msg) | uc=maxurl
rivi=readln(msg)
rivi=rivi || ' ' /* Just making sure there is a space at the end */
do while uc<maxurl & (pos('GOPHER://',upper(rivi))>0 | pos('FILE://',upper(rivi))>0 | pos('HTTP://',upper(rivi))>0 | pos('FTP://',upper(rivi))>0)
/* There might be several URLs on one line */
b=pos('HTTP://',upper(rivi)) /* beginning */
if b=0 then b=pos('FTP://',upper(rivi))
/* Adding other types is easy, just add a line like this: */
if b=0 then b=pos('GOPHER://',upper(rivi))
if b=0 then b=pos('FILE://',upper(rivi))
e=pos(' ',rivi,b) /* space ends the URL */
if e-pos('//',rivi,b)>2 then do /* only save if URL has chars in it */
call AddURL(substr(rivi,b,e-b)) /* save URL */
do while uc<maxurl & pos(right(url.uc,1),dup_chars)>0
/* Add another URL without the last character */
spare=left(url.uc,length(url.uc)-1)
call AddURL(spare)
end /* do while uc<maxurl & pos */
end /*if e-pos('//',rivi,b)>2*/
rivi=right(rivi,length(rivi)-e)
end /* do while uc<maxurl & (pos('FILE://',upper(rivi))> */
end /* do until eof(msg) */
close(msg)
end /* if open(msg,fname,'R') then do */
end /* if pos(result,'UN')=0 then do */
end /* do viesti=0 to n-1 */
writeln(hotlist,'</ul><hr><a href="mailto:knikulai@utu.fi">Send praise or bug reports to Kai.Nikulainen@utu.fi</a></body></html>')
call close(hotlist)
if uc=0 then
'request "'||not_found||'" "_Ok"'
else do
lst=show('P') || ' '
if pos('MINDWALKER',lst)>0 then
address 'MINDWALKER' 'OpenURL file:///'|| hname
if pos('IBROWSE',lst)>0 then
address 'IBROWSE' 'GotoURL file:///' || hname
if pos('AWEB',lst)>0 then do
address value substr(lst,pos('AWEB.',lst),6)
'Open file://localhost/' || hname
end
end /* else */
exit
AddURL:
parse arg u
do i=1 to uc
if url.i=u then return
end
uc=uc+1
url.uc=u
if sub~='' then do /* First write the subject of the message */
writeln(hotlist,'</ul><p><p><strong>'|| sub ||'</strong><ul>')
sub=''
end
writeln(hotlist,'<li><a href="'|| u ||'">'|| u ||'</a>')
return